<#if parentId?has_content>
    <@cms.content id=parentId>
        <#assign parent=object/>
    </@cms.content>
</#if>
<@sys.authorized roleIds=admin.roles urls='cmsCategory/add'><#assign authorizedMap=map/></@sys.authorized>
<div class="pageFormContent">
    <ul class="tree treeFolder" layoutH>
<#if categoryId?has_content>
    <@cms.category id=categoryId>
        <#if object.typeId?has_content && authorizedMap['cmsCategory/add']>
            <li><a href="cmsCategory/add.html?id=${categoryId!}" target="navTab" rel="cmsCategory/edit"><i class="icon-edit icon-large"></i><@t.page 'category.edit'/></a></li>
        </#if>
    </@cms.category>
    <#assign size=0/>
    <@cms.modelList parentId=(parent.modelId)!''>
        <#list page.list as a>
            <@cms.categoryModel modelId=a.id categoryId=categoryId>
                <#assign size++/>
        <li><a href="cmsContent/add.html?categoryId=${(parent.categoryId)!categoryId!}&modelId=${a.id}&parentId=${parentId!}" target="navTab" rel="cmsContent/add"><@t.page 'button.add_some_things' a.name/></a></li>
            </@cms.categoryModel>
        </#list>
    </@cms.modelList>
    <#if size=0 && authorizedMap['cmsCategory/add']>
        <li><a href="cmsCategory/add.html?id=${categoryId!}&showTab=model" target="navTab" rel="cmsCategory/edit" title="<@t.page 'category.edit'/>"><i class="icon-edit icon-large"></i><@t.page 'content.no_model'/></a></li>
    </#if>
</#if>
    </ul>
</div>
<script>
$('ul li a',$.pdialog.getCurrent()).click(function(){
    $.pdialog.closeCurrent();
});
</script>
<div class="formBar">
    <ul>
        <li><button type="button" class="button close"><@t.page 'button.close'/></button></li>
    </ul>
</div>
